﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YesSql.Indexes;
using Ruitu.Edu.TrainingDemo.Models;

namespace Ruitu.Edu.TrainingDemo.Indexes
{
    public class BookIndex : MapIndex
    {
        public string Title { get; set; }
        public string Author { get; set; }
    }

    public class BookIndexProvider : IndexProvider<Book>
    {
        public override void Describe(DescribeContext<Book> context)
        {
            context.For<BookIndex>()
                .Map(book => new BookIndex
                {
                    Title = book.Title,
                    Author = book.Author
                });
        }
    }
}
